//连接数据库文件
const mongoose=require('mongoose')
//数据库连接地址
const DB_URL='mongodb://localhost:27017/1908';
//连接数据库
mongoose.connect(DB_URL, { useNewUrlParser:true , useUnifiedTopology: true } )
//判断是否连接成功
mongoose.connection.on('connected',()=>{
    console.log('连接成功')
})
mongoose.connection.on('disconnected',()=>{
    console.log('连接失败')
})
mongoose.connection.on('error',()=>{
    console.log('connecr error')
})
module.exports=mongoose